// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "Engine/DataTable.h"
#include "Widgets/GameSettingScreen.h"

#include "LyraSettingScreen.generated.h"

class UGameSettingRegistry;
class ULyraTabListWidgetBase;
class UObject;

UCLASS(Abstract, meta = (Category = "Settings", DisableNativeTick))
class ULyraSettingScreen : public UGameSettingScreen
{
	GENERATED_BODY()

public:

protected:
	/**
	 * 初始化时调用
	 */
	virtual void NativeOnInitialized() override;
	/**
	 * 创建设置注册表
	 * @return 游戏设置注册表
	 */
	virtual UGameSettingRegistry* CreateRegistry() override;

	/**
	 * 处理返回动作
	 */
	void HandleBackAction();
	/**
	 * 处理应用动作
	 */
	void HandleApplyAction();
	/**
	 * 处理取消更改动作
	 */
	void HandleCancelChangesAction();

	/**
	 * 当设置脏状态改变时的处理
	 * @param bSettingsDirty 设置是否脏
	 */
	virtual void OnSettingsDirtyStateChanged_Implementation(bool bSettingsDirty) override;
	
protected:
	UPROPERTY(BlueprintReadOnly, Category = Input, meta = (BindWidget, OptionalWidget = true, AllowPrivateAccess = true)) // 顶部设置标签列表
	TObjectPtr<ULyraTabListWidgetBase> TopSettingsTabs;
	
	UPROPERTY(EditDefaultsOnly) // 返回输入动作数据
	FDataTableRowHandle BackInputActionData;

	UPROPERTY(EditDefaultsOnly) // 应用输入动作数据
	FDataTableRowHandle ApplyInputActionData;

	UPROPERTY(EditDefaultsOnly) // 取消更改输入动作数据
	FDataTableRowHandle CancelChangesInputActionData;

	FUIActionBindingHandle BackHandle; // 返回句柄
	FUIActionBindingHandle ApplyHandle; // 应用句柄
	FUIActionBindingHandle CancelChangesHandle; // 取消更改句柄
};